package Operation;

import Book.Library;

import java.util.Scanner;

public class BackBook implements IOperation{
    @Override
    public void work(Library library) {
        System.out.println("还书");
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入要还的书的名字：");
        String name = scanner.nextLine();
        for (int i = 0; i < library.getSize(); i++) {
            if(library.getBook(i).getName().equals(name)) {
                System.out.println("还书成功");
                library.getBook(i).setSituation(false);
                return;
            }
        }
    }
}
